package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 小程序端服务项接口
 *
 * @Author Ls
 * @Date 2025/10/22 21:31
 */
@Slf4j
@Api(tags = "服务项接口")
@RestController
@RequestMapping("/member/orders/project")
public class MemberOrderController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation("分页查询")
    public TableDataInfo list(NursingProject nursingProject){
        log.info("分页查询--前端传来的参数为{}", nursingProject);
        startPage();
        List<NursingProject> list = nursingProjectService.list();
        return getDataTable(list);
    }

    @GetMapping("/{id}")
    @ApiOperation("根据编号查询护理项目信息")
    public AjaxResult geById(@PathVariable Long id){
        log.info("根据编号查询护理项目信息--前端传来的参数为{}", id);
        return AjaxResult.success(nursingProjectService.getById(id));
    }
}
